<?php

    class CicpDeveloperTest implements Cicp_Handler_Interface
{
    function initGraph($x, $y, $z)
    {
        $graph = new Cicp_Graph();
        $graph->setPosition($x, $y, $z+1);
        $menu = new Cicp_Graph_Menu('newPrim');
        $menu->addButton('Refresh');
        $menu->addButton('Delete', Cicp_Graph_Menu::BUTTON_DELETE);
        $menu->addButton('Start/Stop Live', Cicp_Graph_Menu::BUTTON_LIVE);
        $graph->addMenu($menu);
        $node = $graph->createNode();
        $node->assignMenu($menu);
        $node->setTitle("Hello, World!");
        $node->setPosition(0, 0, 0);
        $node->setDimensions(.5, 1, 0);
        return $graph;
    }

    function menuChoice(Cicp_Graph $graph, Cicp_Graph_Node $node, Cicp_Graph_Menu $menu, $menuButtonLabel)
    {
        $node = $graph->getNodeById($graph->getHighestNodeId());
        $dimensions = array(rand(0, 10), rand(0, 10), rand(0, 10));
        $node->setDimensions($dimensions[0], $dimensions[1], $dimensions[2]);
        $node->setTitle(implode(',', $dimensions));
        return $graph;
    }
}